package com.len.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.len.base.BaseEntity;
import com.len.entity.base.FlexBaseEntity;
import com.mybatisflex.annotation.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
@Table("sys_menu")
@EqualsAndHashCode(callSuper = true)
public class SysMenu extends FlexBaseEntity {

    private static final long serialVersionUID = 1L;
    /**
     * 编码
     */
    private String code;

    private String name;

    private String pId;

    private String url;

    /**
     * 路由
     */
    private String router;
    /**
     * 排序字段
     */
    private Integer orderNum;
    /**
     * 图标
     */
    private String icon;
    /**
     * 权限
     */
    private String permission;
    /**
     * 1栏目2菜单
     */
    private Byte menuType;
    @TableField(exist = false)
    private List<SysRole> roleList;
    @TableField(exist = false)
    private List<SysMenu> children = new ArrayList<SysMenu>();

    public void addChild(SysMenu sysMenu) {
        children.add(sysMenu);
    }

}